﻿using System;

namespace ChangeNote
{
    public class changeNote
    {

        public int[] Changenote(decimal price, decimal payment)
        {
            decimal[] currency = new decimal[8] { 100, 50, 20, 10, 5, 1, 0.5m, 0.1m };
            int[] number = new int[8];
            decimal changenote = payment - price;


            for (int n = 0; n < currency.Length; n++)
            {
                if (changenote >= currency[n])
                {
                    number[n] = (int)(changenote / currency[n]);
                    changenote -= (number[n] * currency[n]);
                }
                if (changenote == 0)
                    break;

            }

            return number;
        }


    }
}
